package ExerciseOne;

public class ExtendsExer {
	public static void main(String[] args) {
//		Per p = new Per();
//		p.eat();
//		Stud s = new Stud();
//		s.eat();
//		Per p1 = new Stud();
//		p1.eat();
//		Stud s1 = (Stud)p1;
//		s1.sport();
		ExtendsExer e = new ExtendsExer();
		e.show(new Stud());
		//e.show(new Stud2());
	}

	public void show(Per p)
	{
		p.eat();
		Stud s = (Stud)p;
		s.sport();
//		Stud2 s1 = (Stud2)p;
//		s1.sleep();
	}
}

class Per
{
	public void eat()
	{
		System.out.println("吃饭");
	}
}


class Stud extends Per
{
	@Override
	public void eat() {
		//super.eat();
		System.out.println("好好吃饭");
	}
	public void sport()
	{
		System.out.println("多运动");
	}
}

class Stud2 extends Per
{
	@Override
	public void eat() {
		System.out.println("Stud2好好吃饭");
	}
	public void sleep()
	{
		System.out.println("睡觉");
	}
}